@extends('layouts.admin')
@section('style')
    <style type="text/css">
        .box_form .layui-input-inline{
            width:400px;
            min-width:200px;
        }
        .layui-form-select dl{
            z-index:99999;
        }
    </style>
@endsection
@section('content')
    <div class="admin_main">
        <div class="admin_header_fixed">
            <div class="admin_header clearfix">
                <div class="title"><i></i>编辑订单</div>
                <div class="action">
                    <b></b>
                    <div class="layui-btn-group layui-btn-group-only">
                        <a class="layui-btn layui-btn-primary layui-btn-small " href="{{ url('order') }}">
                            <i class="fa fa-reply"></i> 返回订单列表
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <div class="admin_base">
            <div class="box_form">
                <div class="box_content">
                    <form method="post" action="{{ url('order/'.$vo->id) }}" id="VoForm" class="layui-form" novalidate="1">
                        {{ csrf_field() }}
                        {{ method_field('PUT') }}
                        <fieldset class="layui-elem-field">
                            <legend style="font-size:16px;margin-bottom:10px">基本信息</legend>
                            <div class="layui-row">
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><span>*</span>所属店铺</label>
                                        <div class="layui-input-inline">
                                            <select disabled readonly="" style="z-index:9999;" >
                                                <option value="">请选择所属店铺</option>
                                                @foreach($shops as $shop)
                                                    <option value="{{ $shop->id }}" @if($shop->id==$vo->shop_id) selected @endif>{{ $shop->title }}</option>
                                                @endforeach
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">宝贝ID</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="item_id" placeholder="请输入宝贝ID" value="{{ $vo->item_id }}" id="item_id"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">宝贝标题</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="item_title" placeholder="请输入宝贝标题" value="{{ $vo->item_title }}" id="item_title"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><span>*</span>宝贝价格</label>
                                        <div class="layui-input-inline">
                                            <input type="number" name="price" id="price" placeholder="请输入宝贝价格" value="{{ $vo->price }}"
                                                   id="seller_name" class="layui-input">
                                        </div>
                                   </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><span>*</span>佣金</label>
                                        <div class="layui-input-inline">
                                            <input type="number" name="commission" id="commission" placeholder="请输入佣金" value="{{ $vo->commission }}"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">&nbsp;</label>
                                        <div class="layui-input-block admin_bottom" style="">
                                            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">
                                                立即提交
                                            </button>
                                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-md6"  style="border-left:1px solid #ececec;">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><span>*</span>买家账号</label>
                                        <div class="layui-input-inline">
                                            <input type="text" readonly disabled placeholder="请输入买家账号" value="{{ $vo->account_no }}"
                                                   id="account_no" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><span>*</span>订单编号</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="order_no" placeholder="请输入订单编号" value="{{ $vo->order_no }}"
                                                   id="order_no" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">订单时间</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" readonly="readonly" name="order_time" id="order_time" value="{{ $vo->order_time }}" style="width:200px;" />
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><span>*</span>实转金额</label>
                                        <div class="layui-input-inline">
                                            <input type="number" name="money_sj" id="money_sj" placeholder="请输入实际转账金额" value="{{ $vo->money_sj }}" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><span>*</span>其中佣金</label>
                                        <div class="layui-input-inline">
                                            <input type="number" name="money_sj" id="commission_sj" placeholder="请输入实转金额中佣金金额" value="{{ $vo->commission_sj }}" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">备注</label>
                                        <div class="layui-input-block">
                                            <textarea name="comm" class="layui-textarea">{{ $vo->comm }}</textarea>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
        <div class="admin_bottom"></div>
    </div>
@endsection
@section('script')
    <script type="text/javascript" src="{{ asset('files/ueditor/ueditor.config.js') }}"></script>
    <script type="text/javascript" src="{{ asset('files/ueditor/ueditor.all.js') }}"></script>
    <script type="text/javascript" src="{{ asset('files/ueditor/lang/zh-cn/zh-cn.js') }}"></script>
    <script type="text/javascript">
        layui.use(['form','laydate', 'element', 'layer', 'utils', 'formField'], function () {
            var form = layui.form;
            var element = layui.element;
            var URL = layui.utils.URL;
            var errorTip = layui.utils.errorTip;
            var $ = layui.$;
            var laydate = layui.laydate;
            var temp = laydate.render({
                elem:'#order_time',
                type:'datetime',
                change:function(value,date,endDate){
                }
            })
            form.on('submit(save)', function (data) {
                var url = $(data.form).prop('action');
                var data = data.field;
                URL.post(url, data, {
                    dataType: 'json',
                    success: function (res) {
                        if (res.code == 1) {
                            layer.msg(res.message, {icon: 6, times: 2000}, function () {
                                document.location.href=res.data.redirect;
                            })
                        } else {
                            var errors = res.errors;
                            if (typeof errors != 'undefined') {
                                errorTip(errors);
                            } else {
                                layer.msg(res.message, {icon: 5, times: 2000});
                            }
                        }
                    }
                })
                return false;
            })
        });
    </script>
@endsection